/*
 * This file is part of Ember.
 *
 * Ember is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Ember is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Ember.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Copyright (C) Grant Tyra 2010
 * granttyra@gmail.com
*/

#ifndef EMBER_CLASS_H
#define EMBER_CLASS_H

#include "ember_config.h"
#include "ember_dictionary.h"
#include "ember_list.h"

typedef struct tagMethod {
    void *function;
    EmberList *arguments;
    int isNative;
} EmberMethod;

typedef struct tagClassDef {
    char *name;
    struct tagClassDef *parent;
    EmberDictionary *attributes;
    EmberDictionary *instMethods;
	EmberDictionary *classMethods;
} EmberClassDef;

EMBER_EXPORT void EmberClassMapInitialize();
EMBER_EXPORT void EmberClassMapDestroy();

EMBER_EXPORT void EmberClassMapPut(EmberClassDef*);
EMBER_EXPORT EmberClassDef *EmberClassMapGet(const char*);

EMBER_EXPORT EmberClassDef *EmberClassCreate(const char*, const char*);
EMBER_EXPORT void EmberClassDestroy(EmberClassDef*);

EMBER_EXPORT char *EmberClassBuild(EmberClassDef**, EmberList*, int, int, int*);

EMBER_EXPORT EmberMethod *EmberMethodCreate(const char*, int, void*);
EMBER_EXPORT void EmberMethodDestroy(EmberMethod*);

EMBER_EXPORT void EmberClassMapValues(EmberList*);

EMBER_EXPORT EmberMethod *EmberClassGetInstanceMethod(EmberClassDef*, const char*);
EMBER_EXPORT EmberMethod *EmberClassGetStaticMethod(EmberClassDef*, const char*);

EMBER_EXPORT void EmberClassAddInstanceMethod(EmberClassDef*, const char*, EmberMethod*);
EMBER_EXPORT void EmberClassAddStaticMethod(EmberClassDef*, const char *, EmberMethod*);

EMBER_EXPORT void *EmberClassGetAttribute(EmberClassDef*, const char*);
EMBER_EXPORT void EmberClassPutAttribute(EmberClassDef *, const char*, void*);

extern EmberDictionary *emberClassMap;

#endif
